﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Entities;
using Datalayer;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Repository;
using DevExpress.XtraEditors.Controls;
using DevExpress.Utils;

namespace Common
{
    public class cl_grvLookupedit
    {
        public static void rpcb_TenChuHo(ref RepositoryItemLookUpEdit cb,string IDchuho)
        {
            IQueryMgr iq = QueryMgr.GetDbInstance();

            cb.DataSource = iq.QHGD_GetQuanHeGiaDinhByIsChuHo_HoNgheoID(IDchuho);
            cb.DisplayMember = "Ten_ThanhVien";
            cb.ValueMember = "Ma_ChiTiet";

            cb.Columns.Clear();
            LookUpColumnInfo colum = new LookUpColumnInfo();
            colum.Caption = "Quan hệ với chủ hộ";
            colum.FieldName = "Ten_ThanhVien";
            cb.Columns.Add(colum);
        }

        public static void rpcb_Quanhechuho(ref RepositoryItemLookUpEdit cb)
        {
            IQueryMgr iq = QueryMgr.GetDbInstance();

            cb.DataSource = iq.QHTV_GetAllQuanHeThanhVien();
            cb.DisplayMember = "Ten_QuanHe";
            cb.ValueMember = "Ma_QuanHe";

            cb.Columns.Clear();
            LookUpColumnInfo colum = new LookUpColumnInfo();
            colum.Caption = "Quan hệ với chủ hộ";
            colum.FieldName = "Ten_QuanHe";
            cb.Columns.Add(colum);
        }

        public static void rpcb_Dantoc(ref RepositoryItemLookUpEdit cb)
        {
            IQueryMgr iq = QueryMgr.GetDbInstance();

            cb.DataSource = iq.DT_GetAllDanToc();
            cb.DisplayMember = "Ten_DanToc";
            cb.ValueMember = "Ma_DanToc";

            cb.Columns.Clear();
            LookUpColumnInfo colum = new LookUpColumnInfo();
            colum.Caption = "Dân tộc";
            colum.FieldName = "Ten_DanToc";
            cb.Columns.Add(colum);
        }

        public static void rpcb_ChinhSach(ref RepositoryItemLookUpEdit cb)
        {
            IQueryMgr iq = QueryMgr.GetDbInstance();

            cb.DataSource = iq.CS_GetAllChinhSach();
            cb.DisplayMember = "Ten_ChinhSach";
            cb.ValueMember = "Ma_ChinhSach";

            cb.Columns.Clear();
            LookUpColumnInfo colum = new LookUpColumnInfo();
            colum.Caption = "Đối tượng chính sách người có công";
            colum.FieldName = "Ten_ChinhSach";
            cb.Columns.Add(colum);
        }

        public static void rpcb_DoiTuongCoCong(ref RepositoryItemLookUpEdit cb)
        {
            IQueryMgr iq = QueryMgr.GetDbInstance();

            cb.DataSource = iq.DTCC_GetAllDoiTuongCoCong();
            cb.DisplayMember = "Ten_DoiTuongCocong";
            cb.ValueMember = "Ma_DoiTuongCoCong";

            cb.Columns.Clear();
            LookUpColumnInfo colum = new LookUpColumnInfo();
            colum.Caption = "Đối tượng chính sách người có công";
            colum.FieldName = "Ten_DoiTuongCocong";
            cb.Columns.Add(colum);
        }

        public static void rpcb_DoiTuongBaoTroXaHoi(ref RepositoryItemLookUpEdit cb)
        {
            IQueryMgr iq = QueryMgr.GetDbInstance();

            cb.DataSource = iq.BTXH_GetAllBaoTroXaHoi();
            cb.DisplayMember = "Ten_BaoTroXH";
            cb.ValueMember = "Ma_BaoTroXH";

            cb.Columns.Clear();
            LookUpColumnInfo colum = new LookUpColumnInfo();
            colum.Caption = "Đối tượng bảo trợ xã hội";
            colum.FieldName = "Ten_BaoTroXH";
            cb.Columns.Add(colum);
        }

        public static void rpcb_CapDangTheoHoc(ref RepositoryItemLookUpEdit cb)
        {
            IQueryMgr iq = QueryMgr.GetDbInstance();

            cb.DataSource = iq.CH_GetAllCapHoc();
            cb.DisplayMember = "Ten_CapHoc";
            cb.ValueMember = "Ma_CapHoc";

            cb.Columns.Clear();
            LookUpColumnInfo colum = new LookUpColumnInfo();
            colum.Caption = "Cấp đang theo học";
            colum.FieldName = "Ma_CapHoc";
            cb.Columns.Add(colum);
        }

        public static void rpcb_TinhTrangViecLam(ref RepositoryItemLookUpEdit cb)
        {
            IQueryMgr iq = QueryMgr.GetDbInstance();

            cb.DataSource = iq.TTVL_GetAllTinhTrangViecLam();
            cb.DisplayMember = "Ten_ViecLam";
            cb.ValueMember = "Ma_ViecLam";

            cb.Columns.Clear();
            LookUpColumnInfo colum = new LookUpColumnInfo();
            colum.Caption = "Tình Trạng Việc Làm";
            colum.FieldName = "Ten_ViecLam";
            cb.Columns.Add(colum);
        }

        public static void rpcb_MucDoDieuDuong(ref RepositoryItemLookUpEdit cb)
        {
            IQueryMgr iq = QueryMgr.GetDbInstance();

            cb.DataSource = iq.MDD_GetAllMucDieuDuong();
            cb.DisplayMember = "Ten_MucDieuDuong";
            cb.ValueMember = "Ma_MucDieuDuong";

            cb.Columns.Clear();
            LookUpColumnInfo colum = new LookUpColumnInfo();
            colum.Caption = "Mức độ điều dưỡng";
            colum.FieldName = "Ten_MucDieuDuong";
            cb.Columns.Add(colum);
        }
    }
}
